<template>
  <div>
    <template v-if="form.length">
      <pagination  :total="total" :page.sync="pageNum" :limit.sync="pageSize" @pagination="onPage"/>
      <el-table
        v-loading="loading"
        :data="form"
        style="width: 100%;margin-bottom: 20px;">
        <el-table-column
          prop="matter"
          label="事项"
          width="180">
        </el-table-column>
        <el-table-column
          prop="deptId"
          label="服务商ID"
          width="180">
        </el-table-column>
        <el-table-column
          prop="phonenumber"
          label="手机账号">
        </el-table-column>
        <el-table-column
          prop="updateBy"
          label="操作人">
        </el-table-column>
        <el-table-column
          prop="operTime"
          label="操作时间">
        </el-table-column>
      </el-table>
    </template>
    <template v-else>
      <el-empty :image-size="80" description="暂无账号日志"></el-empty>
    </template>
  </div>
</template>

<script>
import { getAccountLog  } from "@/api/system/dept";
export default {
  name: 'accountLog',
  props: {
    active: {
      type: String,
      default: () => ''
    },
    data: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      pageNum: 1,
      pageSize: 10,
      queryParams: {
        userId:''
      },
      form: [],
    };
  },
  watch: {
    data: {
      handler(val) {
        this.queryParams.userId=val.userId

      },
      deep:true,
      immediate:true
    },
    active(a, b) {
      a === 'accountLog' && this.getList()
    }
  },
  created() {
    this.active==='accountLog' && this.getList()
  },
  methods: {
    getList(){
      this.loading = true
      getAccountLog(this.queryParams).then(res => {
        this.form=res.rows
        this.total = res.total;
        this.loading = false
      }).catch(err => {
        this.loading = false
      })
    },
    onPage(e) {
      this.pageNum = e.page
      this.pageSize = e.limit
      this.getList()
    },
  }
};
</script>
